package net.xdclass.job;

import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import net.xdclass.service.TrafficService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author Administrator
 * @description 过期流量包处理
 * @since 2023-11-07 22:22
 */
@Component
@Slf4j
public class TrafficJobHandler {

    @Autowired
    private TrafficService trafficService;

    @XxlJob(value = "TrafficExpiredJobHandler", init = "init", destroy = "destroy")
    public ReturnT<String> execute(String param) {
        log.info("TrafficExpiredJobHandler execute >>>>>>");
        log.info("删除过期流量包");
        trafficService.deleteExpireTraffic();
        return ReturnT.SUCCESS;
    }

    private void init() {
        log.info("TrafficExpiredJobHandler init >>>>>>>");
    }

    private void destroy() {
        log.info("TrafficExpiredJobHandler destroy >>>>>>>");
    }


}
